import axios from 'axios';
import qs from 'qs';



export default {
    Logins({ commit, state }, info) {
        return new Promise((resolve, reject) => {
            axios.post('http://haoyu9558.site/server/testPHP/login.php', qs.stringify(info)).then((res) => {
                commit("SET_USERNAME", res.data.username);
                commit('SET_ROLE', res.data.role);
                resolve(res.data);
            })
        })
    },
    setRoles({ commit, state }, newRouters) {
        commit('SET_NEWROUTER', newRouters);
    }
}